<!-- Generated automatically from an XML file of the same name.
     Copyright: Stephen J. Sangwine and Nicolas Le Bihan, 2008-2010.
--><html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
   <title>fprintf :: Functions (Quaternion Toolbox Function Reference)
</title><link rel="stylesheet" href="qtfmstyle.css" type="text/css"></head><body><h1>Quaternion Function Reference</h1><h2>fprintf</h2>
<p>Write formatted data to file<br>(Quaternion overloading of standard MATLAB&reg; function)
</p>
<h2>Syntax</h2><p><tt>count = fprintf(FID, format, A)</tt></p>
<h2>Description</h2>
<p>
This function overloads the MATLAB&reg; function of the same name for
quaternion data. Only one quaternion argument is permitted, unlike the standard
MATLAB&reg; function. The FID parameter may be omitted, in which case
the output is sent to the standard output.
</p>
<p>
The output is formatted with one quaternion per line of output.
Spaces are automatically inserted between each of the components
of each quaternion, and a \n is automatically inserted after each
quaternion value output. The format string supplied should therefore
not include spaces or \n.
</p>

<h2>Examples</h2>
<pre>
&gt;&gt; q = randq(2)
 
q = 2x2 quaternion array
 
&gt;&gt; count = fprintf('%11.4g', q)
     0.1347     -0.7949     -0.1818      -0.563
    -0.7562      0.4209      0.4884     -0.1119
     0.7196     -0.5344     -0.2204      0.3847
    -0.3163     -0.5328     -0.7841      0.0355

count = 192

&gt;&gt; show(q)
 
q.S =
 
    0.1347   -0.7562
    0.7196   -0.3163

q.X =
 
   -0.7949    0.4209
   -0.5344   -0.5328

q.Y =
 
   -0.1818    0.4884
   -0.2204   -0.7841

q.Z =
 
   -0.5630   -0.1119
    0.3847    0.0355
</pre>

<h2>See Also</h2>QTFM function: <a href="write.html">write</a><br>MATLAB&reg; function: <a href="matlab:doc fprintf">fprintf</a><br>
<h4>&copy; 2008-2010 Stephen J. Sangwine and Nicolas Le Bihan</h4><p><a href="license.html">License terms.</a></p></body></html>